write a algorithm for push and pop operation in stack